﻿@using System.Collections
@using Projectmanagement.Entity
@using Projectmanagement.Models
@model IQueryable<Project>
@{
    ViewBag.Title = "Task";
    string type = ViewBag.type;
 
}
@Html.Hidden("jibie", Employee.CurrentRoleLVL)
@Html.Hidden("hidProject")
@Html.Hidden("hidMember")

@(Html.Telerik().Grid<_ProjectTaskSchedule>()
        .Name("ProjectTask").HtmlAttributes(new { @class="taskindex"})
    .DataKeys(keys => { keys.Add(item => item.ProjectCode); })
    .ClientEvents(events => events.OnEdit("onEdit")
                .OnDataBinding("Grid_onDataBinding")
        //    .OnLoad("Grid3_onLoad")
            )
    .ToolBar(toolBar => toolBar.Template(
                                    @<text>
                                 <label for="type">
    项目纬度表</label>    
                                    @Html.Partial("_ProjectMemberFilter")
</text>
                                                                                         ))
                                                         .DataBinding(dataBinding =>
                                                         {
                                                             dataBinding.Ajax()
                                                                 .Select("_SelectAllTaskIndex", "ProjectTaskSchedule");
                                                                
                                                         })
                                                         .Columns(columns =>
                                                         {
                                                             columns.Bound(item => item.ProjectCode).Width(100);
                                                             columns.Bound(item => item.PMName).Width(100);
                                                             columns.Bound(item => item.NotStarted).Width(100);
                                                             columns.Bound(item => item.Underway).Width(100);
                                                             columns.Bound(item => item.Suspend).Width(100);
                                                             columns.Bound(item => item.Cancel).Width(100);
                                                             columns.Bound(item => item.Pass).Width(100);
                                                             columns.Bound(item => item.SeekHelp).Width(100);
                                                             columns.Bound(item => item.PleaseExamine).Width(100);
                                                             columns.Bound(item => item.Faield).Width(100);
                                                             
                                                         })
                                                         .Editable(editing => editing.Mode(GridEditMode.PopUp))
                                                         .Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true))
                                                         .Scrollable(c => c.Height("353px"))
                                                         .Sortable()
                                                         .Resizable(resizing => resizing.Columns(true))
                                                           )

@(Html.Telerik().Grid<_ProjectMemberSchedule>()
        .Name("PeopleTask").HtmlAttributes(new { @class="taskindex"})
    .DataKeys(keys => { keys.Add(item => item.ProjectCode); })
    .ClientEvents(events => events.OnEdit("onEdit")
                .OnDataBinding("Grid_onDataBinding")
        //    .OnLoad("Grid3_onLoad")
            )
    .ToolBar(toolBar => toolBar.Template(
                                    @<text>
                                 <label for="type">
    员工纬度表</label>    
                                    @Html.Partial("_ProjectMemberFilter")
</text>
                                                                                         ))
                                                         .DataBinding(dataBinding =>
                                                         {
                                                             dataBinding.Ajax()
                                                                 .Select("_SelectPeopleTaskIndex", "ProjectTaskSchedule");
                                                                
                                                         })
                                                         .Columns(columns =>
                                                         {
                                                             columns.Bound(item => item.Name).Width(100);
                                                             columns.Bound(item => item.ProjectCode).Width(100);
                                                             columns.Bound(item => item.NotStarted).Width(100);
                                                             columns.Bound(item => item.Underway).Width(100);
                                                             columns.Bound(item => item.Suspend).Width(100);
                                                             columns.Bound(item => item.Cancel).Width(100);
                                                             columns.Bound(item => item.Pass).Width(100);
                                                             columns.Bound(item => item.SeekHelp).Width(100);
                                                             columns.Bound(item => item.PleaseExamine).Width(100);
                                                             columns.Bound(item => item.Faield).Width(100);
                                                             
                                                         })
                                                         .Editable(editing => editing.Mode(GridEditMode.PopUp))
                                                         .Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true))
                                                         .Scrollable(c => c.Height("353px"))
                                                         .Sortable()
                                                         .Resizable(resizing => resizing.Columns(true))
                                                           )
<script type="text/javascript">

    function Grid_onDataBinding(e) {
        var conferenceid = $("#hidProject").val();
        if ($("#hidProject").val() == "-请选择-") {
            conferenceid = "";
        }
        var member = $("#hidMember").val();
        if ($("#hidMember").val() == "-请选择-") {
            member = "";
         }
        e.data = {
            conferenceid: conferenceid,
            member: member

        };
    }

    function showtask(id) {
        $.post('Task/GetDetail/', { taskid: id }, function (result) {
            $('.TastMessageAll-wrapper').html(result);
            var window = $('#TastMessageAll').data('tWindow');
            window.center().open();
        });
    }

    $(document).ready(function () {
        initialProjectMemberfilter();

        $(".projectfilter").change(function () {
            $("#hidProject").val($(this).closest(".projectfilter").val());
            $(this).closest(".taskindex").data("tGrid").ajaxRequest();
        });

        $(".memberfilter").change(function () {
            var memberValue = $(this).closest(".memberfilter").find("option:selected")[0].text;
            $("#hidMember").val(memberValue);
            $(this).closest(".taskindex").data("tGrid").ajaxRequest();
        });
    });
    function onEdit(e) {
        
    }
    function dtonChange(e) {
        $("form").submit();
    }
</script>
